package fundamental;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;

public class Params {
    public static int depotNum;  //  中转场数量
    public static int custNum;  //  顾客数量
    public static int candNum;  //  备选点数量

    //  两种车型的装载量
    public static int cap1 = 800;
    public static int cap2 = 40;

    //  备选点成本
    public static int cFix = 20;

    //  两种车型的使用成本
    public static double vFix1 = 70;
    public static double vFix2 = 0;

    //  两种车型的行驶成本(车/距离)
    public static double vvar1 = 4.5;
    public static double vvar2 = 6;

    public static double tolerance = 0.0001;  //  求解精度

    public static ArrayList<Depot> depotList = new ArrayList<>();
    public static HashSet<Depot> depotSet = new HashSet<>();
    public static ArrayList<Cand> candList = new ArrayList<>();
    public static HashSet<Cand> candSet = new HashSet<>();
    public static ArrayList<Customer> custList = new ArrayList<>();
    public static HashSet<Customer> custSet = new HashSet<>();

    public static HashSet<Cand> openedCandSet = new HashSet<>();

    //  cand集合的乱序版，用于随机，使用之前需要shuffle
    public static ArrayList<Cand> chaoCandList = new ArrayList<>();

    public static double[][] dist;
    public static LSObj lsObj = new LSObj();
    public static boolean operIsUpdate = false;  //  每个算子迭代是否更新

    //  两级各自的成本
    public static double secCost = Integer.MAX_VALUE;
    public static double firCost = Integer.MAX_VALUE;

    public static double distThres2 = 1.5;  //  距离阈值，插入时如果两点的距离大于该值则不考虑
    public static double distThres1 = 100;
    public static double clusterThres = 2.0;  //  启发式算法中，按照该距离计算备选点周围的点
    public static int aimSize = 10;  //  更换扰动中，选择最小的x个cand
    public static int pairNum;  //  选择x对cust并交换位置

    //  车队集合
    public static ArrayList<FirstVehicle> firstVehicleList = new ArrayList<>();
    public static ArrayList<SecondVehicle> secondVehicleList = new ArrayList<>();

    public static Random random = new Random();

    //  对于每一个cand，按照距离的远近升序排列其他的cand
    public static HashMap<Cand, ArrayList<Cand>> candSortForDist = new HashMap<>();
    //  记录每次迭代的最优解
    public static ArrayList<Double> record = new ArrayList<>();

    public static GiantTSP giantTSP;

    public static boolean getBetter;  //  是否更新了当前最优解

    public static int perturbNImp = 0;  //  连续扰动未改进的次数

    public static int maxIter = 100;  //  连续x次扰动未改进就停止

    public static int maxTime = 3600;  //  最大迭代时间，单位秒

    public static int perturbLevel = 1;  //  有x个cand会发生变化
}
